package com.mlnx.ecg.ui.analysis.utils;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

/**
 * Created by amanda.shan on 2018/2/6.
 */
public class FileUtils {


    public static void copyFile(File source, File dest) {
        FileChannel inputChannel = null;
        FileChannel outputChannel = null;
        try {
            inputChannel = new FileInputStream(source).getChannel();
            outputChannel = new FileOutputStream(dest).getChannel();
            outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
        } catch (Exception e) {
            System.err.println("拷贝文件失败:" + e.getMessage());
        } finally {
            try {
                inputChannel.close();
                outputChannel.close();
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    }
}
